package com.longsys.framework.server.mongo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class MongoEventRepository {

    @Autowired
    private MongoTemplate mongoTemplate;

    public void save(MongoEventEntity mongoEvent) {
        String documentName = MongoCollectionNameUtil.getEventCollectionName(mongoEvent.getSystem());
        mongoTemplate.insert(mongoEvent, documentName);
    }
}
